package myJs.myPkg

import myJs.myPkg.jquery.JQuery
import slinky.readwrite.ObjectOrWritten

import scala.scalajs.js
import scala.language.implicitConversions
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.annotation.JSImport.Namespace

@js.native
@JSImport("bootstrap-datepicker", JSImport.Default)
object BootstrapDatepicker extends js.Object {

}

@js.native
@JSImport("bootstrap-datepicker/dist/locales/bootstrap-datepicker.zh-CN.min.js", JSImport.Default)
object BootstrapDatepickerZh extends js.Object {

}

@js.native
trait DatepickerJQuery extends js.Object {

  def datepicker(options: ObjectOrWritten[DatepickerOptions]): JQuery = scalajs.js.native

  def datepicker(method: String, arg1: String): JQuery = scalajs.js.native

}

case class DatepickerOptions(
                              format: js.UndefOr[String] = js.undefined,
                              language: js.UndefOr[String] = js.undefined,
                              autoclose: js.UndefOr[Boolean] = js.undefined,
                              forceParse: js.UndefOr[Boolean] = js.undefined,
                              showOnFocus: js.UndefOr[Boolean] = js.undefined,
                              clearBtn: js.UndefOr[Boolean] = js.undefined,
                            )

trait DatepickerJQueryImplicits {

  implicit def implicitDatepickerJQuery(jq: JQuery) = {
    jq.asInstanceOf[DatepickerJQuery]
  }
}
